package com.bath.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@org.hibernate.annotations.Entity(dynamicUpdate=true,dynamicInsert=true)
@Table (name = "Sys_M_Role")
public class Role extends Model {
	
	private static final long serialVersionUID = 1455658L;
	private Long 			id;
	private String 			name;
	private Group 			group;
	//private List<Integer> 	roleValues = new ArrayList<Integer>();
	
	public Role() { }

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "Role_ID")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "RoleName")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@ManyToOne
	@JoinColumn(name = "Group_FK")
	public Group getGroup() {
		return group;
	}

	public void setGroup(Group group) {
		this.group = group;
	}

	/*
	@CollectionOfElements(fetch = FetchType.EAGER)
	@JoinTable(name = "Sys_Role_Value", joinColumns = @JoinColumn(name = "Role_FK"))
	@Column(name = "Role_Value")
	@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
	@Fetch(FetchMode.SUBSELECT)
	public List<Integer> getRoleValues() {
		return roleValues;
	}

	public void addRoleValue(int value) {
		this.roleValues.add(value);
	}

	public void setRoleValues(List<Integer> roleValues) {
		this.roleValues = roleValues;
	}
	*/

}
